package com.hua.server.oauth.strategy;

import java.util.Map;

/**
 * 门面处理
 *
 * @author 华云龙
 * @date 2019-5-27
 */
public class TypeAuthorizationServerHandlerContext {

    private Map<String, AuthorizationServerConfigurerStrategy> handlerMap;

    TypeAuthorizationServerHandlerContext(Map<String, AuthorizationServerConfigurerStrategy> handlerMap) {
        this.handlerMap = handlerMap;
    }

    public AuthorizationServerConfigurerStrategy getInstance(String type) {
        AuthorizationServerConfigurerStrategy authorizationServerConfigurerStrategy = handlerMap.get(type);
        if (null == authorizationServerConfigurerStrategy) {
            throw new IllegalArgumentException("not found handler type:" + type);
        }
        return authorizationServerConfigurerStrategy;
    }
}
